package frame;


import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class UsersEnroll {

    private JFrame frame;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    UsersEnroll window = new UsersEnroll();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public UsersEnroll() {
        initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
        frame = new JFrame();
        frame.setBounds(100, 100, 674, 490);
        frame.setLocationRelativeTo(null); // 默认居中显示
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setVisible(true);

        // 设置中间容器，创建自定义容器对象
        MYPanel4 bg = new MYPanel4();
        bg.setBounds(0, 0, 753, 528);
        // 将该容器添加到frame的默认窗口中
        frame.getContentPane().add(bg);
        // 设置bg的布局为绝对布局
        bg.setLayout(null);

        JLabel lblL = new JLabel("\u6B22\u8FCE\u6765\u5230\u516C\u4EA4\u4FE1\u606F\u67E5\u8BE2\u7CFB\u7EDF");
        lblL.setFont(new Font("宋体", Font.PLAIN, 30));
        lblL.setBounds(138, 53, 375, 52);
        bg.add(lblL);

        JButton button = new JButton("\u7EBF\u8DEF\u67E5\u8BE2");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SeekWays sw=new SeekWays();
                frame.setVisible(false);
            }
        });
        button.setBounds(89, 272, 113, 27);
        bg.add(button);

        JButton button_1 = new JButton("\u4E2A\u4EBA\u4FE1\u606F");
        button_1.setBounds(446, 272, 113, 27);
        bg.add(button_1);
        button_1.setEnabled(false);


    }

}

//背景图的设置
class MYPanel4 extends JPanel {
    private Image img;

    // 实现构造方法
    public MYPanel4() {
        // TODO Auto-generated constructor stub
        // 在构造方法中对需要的图片资源进行初始化
        ImageIcon icon = new ImageIcon(UsersLoginFrame.class.getResource("/images/背景图1.jpg"));
        // 将icon类型转换成img类型画入组件
        img = icon.getImage();
    }

    // JPanel父类提供的一个方法来实现“绘制组件”的功能
    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), null);
    }

}
